﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">

    


    protected void btnInsert_Click1(object sender, EventArgs e)
    {
        LOData.InsertParameters[0].DefaultValue = (GridView2.FooterRow.FindControl("TextBox1") as TextBox).Text;
        LOData.InsertParameters[1].DefaultValue = (GridView2.FooterRow.FindControl("TextBox1") as TextBox).Text;
        LOData.InsertParameters[2].DefaultValue = "1";
 
    }


/*
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Detail")
        {
            string id = (GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("Label7") as Label).Text;
            Response.Redirect("/Admin/ManageMajor/?id=" + id);
        }
    }
    */




    protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)
    {


    }



    protected void LinkButton9_Click(object sender, EventArgs e)
    {
        SqlDataSource1.InsertParameters[0].DefaultValue = (Panel1.FindControl("dl3") as DropDownList).Text;
        SqlDataSource1.InsertParameters[1].DefaultValue = (Panel1.FindControl("TextBox8") as TextBox).Text;
        SqlDataSource1.InsertParameters[2].DefaultValue = (Panel1.FindControl("dl4") as DropDownList).Text;
        SqlDataSource1.InsertParameters[3].DefaultValue = (Panel1.FindControl("TextBox9") as TextBox).Text;
        SqlDataSource1.InsertParameters[4].DefaultValue = (Panel1.FindControl("TextBox10") as TextBox).Text;
        SqlDataSource1.InsertParameters[5].DefaultValue = (Panel1.FindControl("TextBox11") as TextBox).Text;
        SqlDataSource1.InsertParameters[6].DefaultValue = "1";

        SqlDataSource1.Insert();
        Panel1.Visible = false;
        InsertBtn.Visible = true;
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        InsertBtn.Visible = false;   
        Panel1.Visible = true;
    }

    protected void LinkButton10_Click(object sender, EventArgs e)
    {
        Panel1.Visible = false;
        InsertBtn.Visible = true;
    }



    protected void DataList1_EditCommand1(object source, DataListCommandEventArgs e)
    {
        DataList1.EditItemIndex = e.Item.ItemIndex;
        DataList1.DataBind();
    }


    protected void DataList1_UpdateCommand1(object source, DataListCommandEventArgs e)
    {
        //SqlDataSource1.UpdateParameters[0].DefaultValue = (e.Item.FindControl("DropDownList1") as DropDownList).Text;
        SqlDataSource1.UpdateParameters[0].DefaultValue = (e.Item.FindControl("TextBox12") as TextBox).Text;
        SqlDataSource1.UpdateParameters[1].DefaultValue = (e.Item.FindControl("DropDownList2") as DropDownList).Text;
        SqlDataSource1.UpdateParameters[2].DefaultValue = (e.Item.FindControl("TextBox13") as TextBox).Text;
        SqlDataSource1.UpdateParameters[3].DefaultValue = (e.Item.FindControl("TextBox14") as TextBox).Text;
        SqlDataSource1.UpdateParameters[4].DefaultValue = (e.Item.FindControl("TextBox15") as TextBox).Text;
        SqlDataSource1.UpdateParameters[5].DefaultValue = (e.Item.FindControl("IDLabel") as Label).Text;

        SqlDataSource1.Update();

        DataList1.EditItemIndex = -1;
        DataList1.DataBind();
 
    }

    protected void DataList1_CancelCommand(object source, DataListCommandEventArgs e)
    {
   
        DataList1.EditItemIndex = -1;
        DataList1.DataBind();
    }

    protected void DataList1_DeleteCommand1(object source, DataListCommandEventArgs e)
    {
        SqlDataSource1.DeleteParameters[0].DefaultValue = (e.Item.FindControl("IDLabel") as Label).Text;
        SqlDataSource1.Delete();
    }

    
    
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        DataView dv2 = (DataView)SqlProgram.Select(DataSourceSelectArguments.Empty);
        
        string appPath = HttpContext.Current.Request.ApplicationPath;
        string physicalPath = HttpContext.Current.Request.MapPath(appPath);

        // start word and get Application object
        Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
        Microsoft.Office.Interop.Word.Document doc = null;
        Microsoft.Office.Interop.Word.Row row;
        // open file
        object filename = physicalPath + "\\Sample Curriculum.docx";
        object nullobj = System.Reflection.Missing.Value;
        doc = word.Documents.Open(ref filename, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        object findText = "Input objectives content here";
        object replaceText = dv2.Table.Rows[0][4].ToString().Trim();
        object replace = Microsoft.Office.Interop.Word.WdReplace.wdReplaceOne;
        doc.Content.Find.Execute(ref findText, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref replaceText, ref replace, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        object findText1 = "Input learning outcomes here";

            
        object replaceText1 = dv2.Table.Rows[0][5].ToString().Trim();
        object replace1 = Microsoft.Office.Interop.Word.WdReplace.wdReplaceOne;
        doc.Content.Find.Execute(ref findText1, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref replaceText1, ref replace1, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        
        
        Microsoft.Office.Interop.Word.Tables lstTable = doc.Tables;


        //Microsoft.Office.Interop.Word.Table tProfessional = lstTable[3];
        //Microsoft.Office.Interop.Word.Table tGraduation = lstTable[4];


        int total = 0;
        int sum = 0;
        int sumProfessional = 0;
        int sumGraduation = 0;
        int sumKnowledge = 0;
        
        //for (int j = 1; j < 4; j++)
        //{
        //    Microsoft.Office.Interop.Word.Table tKnowledge = lstTable[j + 1];
        //    DataView dvLO1 = (DataView)Sql.Select(DataSourceSelectArguments.Empty);
        //    for (int i = 0; i < dvLO1.Table.Rows.Count; i++)
        //    {

        //        row = tKnowledge.Rows.Add(ref nullobj);
        //        row.Cells[1].Range.Text = (i + 1) + "";
        //        row.Cells[2].Range.Text = dvLO1.Table.Rows[i][2].ToString().Trim();
        //        row.Cells[3].Range.Text = dvLO1.Table.Rows[i][3].ToString().Trim();
        //        String a = dvLO1.Table.Rows[i][9].ToString().Trim();
        //        String b = dvLO1.Table.Rows[i][10].ToString().Trim();
        //        row.Cells[5].Range.Text = a;
        //        row.Cells[6].Range.Text = b;
        //        int c = Int32.Parse(a) + Int32.Parse(b);

        //        row.Cells[4].Range.Text = c + "";
        //        temp = c;
        //    }
        //    if (j == 1)
        //    {
        //        sumKnowledge = temp;
        //    }
        //    if (j == 2)
        //    {
        //        sumProfessional = temp;
        //    }
        //    if (j == 3)
        //    {
        //        sumGraduation = temp;
        //    }

        //}

        //total = sumKnowledge + sumProfessional + sumGraduation;
        Microsoft.Office.Interop.Word.Table tCurriculum = lstTable[1];
        DataView dvMajor = (DataView)sqlMajor.Select(DataSourceSelectArguments.Empty);
        
        DataRowCollection majorRows = dvMajor.Table.Rows;
        for (int i = 0; i < majorRows.Count; i++)
        {
            sqlKnowledgeBlock.SelectParameters[0].DefaultValue = majorRows[i][0].ToString().Trim();
            String temp = majorRows[i][0].ToString().Trim();
            DataView dvBlock = (DataView)sqlKnowledgeBlock.Select(DataSourceSelectArguments.Empty);
            DataRowCollection BlockRows = dvBlock.Table.Rows;
            for (int j = 0; j < BlockRows.Count; j++ )
            {
                Microsoft.Office.Interop.Word.Table tKnowledge = lstTable[2+j];
                SqlCourseInfo.SelectParameters[0].DefaultValue = BlockRows[j][0].ToString().Trim();
                DataView dvCourse = (DataView)SqlCourseInfo.Select(DataSourceSelectArguments.Empty);
                for (int k = 0; k < dvCourse.Table.Rows.Count; k++ )
                {
                    row = tKnowledge.Rows.Add(ref nullobj);
                    row.Cells[1].Range.Text = (k + 1) + "";
                    row.Cells[2].Range.Text = dvCourse.Table.Rows[k][2].ToString().Trim();
                    row.Cells[3].Range.Text = dvCourse.Table.Rows[k][3].ToString().Trim();
                    String a = dvCourse.Table.Rows[k][9].ToString().Trim();
                    String b = dvCourse.Table.Rows[k][10].ToString().Trim();
                    row.Cells[5].Range.Text = a;
                    row.Cells[6].Range.Text = b;
                    int c = Int32.Parse(a) + Int32.Parse(b);

                    row.Cells[4].Range.Text = c + "";
                    sum = sum + c;
                    
                }
                if(j == 0)
                    tCurriculum.Cell(2,2).Range.Text = sum +"";
                else if (j == 1)
                {
                    tCurriculum.Cell(3, 3).Range.Text = sum + "";
                }
                else if (j == 2)
                {
                    tCurriculum.Cell(6, 2).Range.Text = sum + "";
                }
                total = total + sum;
                sum = 0;   
                
                
  
            }
            tCurriculum.Cell(7, 2).Range.Text = total + "";
        }


        object findText2 = "insert total credits here";
        object replaceText2 = total + "";
        object replace2 = Microsoft.Office.Interop.Word.WdReplace.wdReplaceOne;
        doc.Content.Find.Execute(ref findText2, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref replaceText2, ref replace2, ref nullobj, ref nullobj, ref nullobj, ref nullobj);


        
            // save file
            filename = physicalPath + "\\Sample Curriculum - Print.docx";
        word.ActiveDocument.SaveAs(ref filename, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        doc.Close(ref nullobj, ref nullobj, ref nullobj);
        word.Quit(ref nullobj, ref nullobj, ref nullobj);


        System.String name = "Sample Curriculum - Print.docx";
        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "Attachment; filename=" + name);
        Response.WriteFile(physicalPath + "\\Sample Curriculum - Print.docx");
        Response.End();
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	MANAGE PROGRAM DETAIL
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1>MANAGE PROGRAM DETAIL</h1>
    <p>
        <asp:Button ID="btnPrint" runat="server" onclick="btnPrint_Click" 
            Text="Print" />
        <asp:SqlDataSource ID="SqlProgram" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
            SelectCommand="SELECT * FROM [Program] WHERE ([ID] = @ID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlCourseInfo" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
            
            
            
            SelectCommand="SELECT * FROM [CourseInfo] WHERE ([KnowledgeBlockID] = @KnowledgeBlockID2)">
            <SelectParameters>
                <asp:Parameter Name="KnowledgeBlockID2" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="sqlKnowledgeBlock" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
            
            SelectCommand="SELECT * FROM [KnowledgeBlock] WHERE ([MajorID] = @MajorID)">
            <SelectParameters>
                <asp:Parameter Name="MajorID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="sqlMajor" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
            SelectCommand="SELECT * FROM [Major] WHERE ([ProgramID] = @ProgramID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ProgramID" QueryStringField="id" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <cc1:TabContainer ID="programTab" runat="server" ActiveTabIndex="0" 
        Width="1139px" Height="600px">
        <cc1:TabPanel runat="server" HeaderText="Major" ID="tabMajor">
            <HeaderTemplate>Major</HeaderTemplate>
            <ContentTemplate>
                <br />
                <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="ID" 
                    DataSourceID="SqlDataSource1" ForeColor="#333333" 
                    oncancelcommand="DataList1_CancelCommand" 
                    oneditcommand="DataList1_EditCommand1" 
                    onupdatecommand="DataList1_UpdateCommand1" 
                    ondeletecommand="DataList1_DeleteCommand1" Width="1128px">
                    <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                    <EditItemTemplate>
                        <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' 
                            Visible="False" />
                        <br />
                        <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' 
                            Visible="False" />
                        <table style="width:100%;">
                            <tr>
                                <td style="width: 402px">
                                    Name:
                                    <asp:TextBox ID="TextBox12" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
                                    <br />
                                    HeadOfMajor:
                                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="a2" 
                                        DataTextField="Name" DataValueField="ID" 
                                        SelectedValue='<%# Eval("HeadOfMajor") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="a2" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                                        SelectCommand="SELECT [ID], [Name] FROM [Professor]"></asp:SqlDataSource>
                                    <br />
                                </td>
                                <td>
                                    Description:<asp:TextBox ID="TextBox13" runat="server" 
                                        Text='<%# Eval("Description") %>'></asp:TextBox>
                                    &nbsp;<br />
                                    Objective:
                                    <asp:TextBox ID="TextBox14" runat="server" Text='<%# Eval("Objective") %>'></asp:TextBox>
                                    <br />
                                    MajorLO:
                                    <asp:TextBox ID="TextBox15" runat="server" Text='<%# Eval("MajorLO") %>'></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                        <asp:LinkButton ID="LinkButton14" runat="server" CommandName="Update">Update</asp:LinkButton>
                        &nbsp;&nbsp;&nbsp;
                        <asp:LinkButton ID="LinkButton15" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
                        <br />
                    </EditItemTemplate>
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <ItemTemplate>
                        <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' 
                            Visible="False" />
                        <br />
                        <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>' 
                            Visible="False" />
                        <table style="width:100%;">
                            <tr>
                                <td style="width: 402px">
                                    Name:
                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                    <br />
                                    HeadOfMajor:
                                    <asp:Label ID="HeadOfMajorLabel" runat="server" 
                                        Text='<%# Eval("ProfName") %>' />
                                    <br />
                                </td>
                                <td>
                                    Description:
                                    <asp:Label ID="DescriptionLabel" runat="server" 
                                        Text='<%# Eval("Description") %>' />
                                    <br />
                                    Objective:
                                    <asp:Label ID="ObjectiveLabel" runat="server" Text='<%# Eval("Objective") %>' />
                                    <br />
                                    MajorLO:
                                    <asp:Label ID="MajorLOLabel" runat="server" Text='<%# Eval("MajorLO") %>' />
                                </td>
                            </tr>
                        </table>
                        <br />
                        <asp:LinkButton ID="LinkButton11" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                        &nbsp;&nbsp;&nbsp;
                        <asp:LinkButton ID="LinkButton12" runat="server" CommandName="delete">Delete</asp:LinkButton>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:LinkButton ID="LinkButton13" runat="server" CommandName="Detail" 
                            PostBackUrl='<%# Bind("ID", "/Admin/ManageMajor/?id={0}") %>'>Detail</asp:LinkButton>
                        <br />
                    </ItemTemplate>
                    <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                    DeleteCommand="UPDATE [Major] SET [Status] = 0 WHERE [ID] = @ID" 
                    InsertCommand="INSERT INTO [Major] ([ProgramID], [Name], [HeadOfMajor], [Description], [Objective], [MajorLO], [Status]) VALUES (@ProgramID, @Name, @HeadOfMajor, @Description, @Objective, @MajorLO, @Status)" 
                    SelectCommand="SELECT Major.ID, Major.ProgramID, Major.Name, Major.HeadOfMajor, Major.Description, Major.Objective, Major.MajorLO, Major.Status, Professor.Name AS ProfName FROM Major INNER JOIN Professor ON Major.HeadOfMajor = Professor.ID WHERE (Major.Status = @Status) AND (Major.ProgramID = @ProgramID)" 
                    
                    
                    UpdateCommand="UPDATE [Major] SET [Name] = @Name, [HeadOfMajor] = @HeadOfMajor, [Description] = @Description, [Objective] = @Objective, [MajorLO] = @MajorLO WHERE [ID] = @ID">
                    <DeleteParameters>
                        <asp:Parameter Name="ID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="ProgramID" Type="Int32" />
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="HeadOfMajor" Type="Int32" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Objective" Type="String" />
                        <asp:Parameter Name="MajorLO" Type="String" />
                        <asp:Parameter Name="Status" Type="Int32" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:Parameter DefaultValue="1" Name="Status" Type="Int32" />
                        <asp:QueryStringParameter Name="ProgramID" QueryStringField="id" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="HeadOfMajor" Type="Int32" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Objective" Type="String" />
                        <asp:Parameter Name="MajorLO" Type="String" />
                        <asp:Parameter Name="ID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <br />
                <asp:Button ID="InsertBtn" runat="server" Text="New Major" 
                    onclick="Button1_Click" /><br /><asp:Panel ID="Panel1" runat="server" Visible="False"><table style="width:91%;"><tr><td bgcolor="#00CCFF" style="width: 406px">
                    ProgramID:<asp:DropDownList ID="dl3" runat="server" DataSourceID="q1" 
                                    DataTextField="Name" DataValueField="ID"></asp:DropDownList>&nbsp;<asp:SqlDataSource ID="q1" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString1 %>" 
                                    SelectCommand="SELECT [ID], [Name] FROM [Program]"></asp:SqlDataSource><br />
                    Name: &nbsp;&nbsp;<asp:TextBox ID="TextBox8" runat="server" Text='<%# Eval("Name") %>' 
                                    Height="22px"></asp:TextBox><br />HeadOfMajor:<asp:DropDownList ID="dl4" runat="server" 
                                    DataSourceID="q2" DataTextField="Name" DataValueField="ID"></asp:DropDownList>
                    &nbsp; <asp:SqlDataSource ID="q2" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString1 %>" 
                                    SelectCommand="SELECT [ID], [Name] FROM [Professor]"></asp:SqlDataSource></td><td bgcolor="#66FFFF">
                        Description: <asp:TextBox ID="TextBox9" runat="server" Text='<%# Eval("Description") %>'></asp:TextBox><br />
                        Objective:<asp:TextBox ID="TextBox10" runat="server" 
                                    Text='<%# Eval("Objective") %>'></asp:TextBox>&nbsp;<br />MajorLO: &nbsp;&nbsp;<asp:TextBox ID="TextBox11" runat="server" Text='<%# Eval("MajorLO") %>'></asp:TextBox><br /></td></tr></table><br /><asp:LinkButton ID="LinkButton9" runat="server" onclick="LinkButton9_Click">Insert</asp:LinkButton>
                    &nbsp;&nbsp;&nbsp; <asp:LinkButton 
                        ID="LinkButton10" runat="server" CommandName="Cancel" 
                        onclick="LinkButton10_Click">Cancel</asp:LinkButton></asp:Panel>
            </ContentTemplate>
        </cc1:TabPanel>
        <cc1:TabPanel ID="tabLearningOutcome" runat="server" HeaderText="Learning Outcome">
        <ContentTemplate>
            <asp:GridView ID="GridView2" runat="server" 
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" 
                DataSourceID="LOData" ForeColor="#333333" GridLines="None" 
                ShowFooter="True" Width="1128px"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" /><asp:TemplateField HeaderText="Code" SortExpression="Code"><EditItemTemplate><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Code") %>'> </asp:TextBox></EditItemTemplate><FooterTemplate><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Code") %>'> </asp:TextBox></FooterTemplate><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("Code") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Description" SortExpression="Description"><EditItemTemplate><asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'> </asp:TextBox></EditItemTemplate><FooterTemplate><asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'> </asp:TextBox></FooterTemplate><ItemTemplate><asp:Label ID="Label2" runat="server" Text='<%# Bind("Description") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:BoundField DataField="Status" HeaderText="Status" 
                    SortExpression="Status" Visible="False" /><asp:TemplateField ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate><FooterTemplate><asp:LinkButton ID="btnInsert" runat="server" onclick="btnInsert_Click1"> 
                            LinkButton</asp:LinkButton></FooterTemplate><ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                            CommandName="Edit" Text="Edit"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Delete" Text="Delete"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle 
                BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="LOData" runat="server" 
                ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString1 %>" 
                DeleteCommand="UPDATE ProgramOutcome SET Status = 0 WHERE (ID = @ID)" 
                InsertCommand="INSERT INTO [ProgramOutcome] ([Code], [Description], [Status]) VALUES (@Code, @Description, @Status)" 
                SelectCommand="SELECT * FROM [ProgramOutcome] WHERE ([Status] = @Status)" 
                UpdateCommand="UPDATE [ProgramOutcome] SET [Code] = @Code, [Description] = @Description WHERE [ID] = @ID"><SelectParameters><asp:Parameter DefaultValue="1" Name="Status" Type="String" /></SelectParameters><DeleteParameters><asp:Parameter Name="ID" Type="Int32" /></DeleteParameters><UpdateParameters><asp:Parameter Name="Code" Type="String" /><asp:Parameter Name="Description" Type="String" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters><InsertParameters><asp:Parameter Name="Code" Type="String" /><asp:Parameter Name="Description" Type="String" /><asp:Parameter Name="Status" Type="String" /></InsertParameters></asp:SqlDataSource>
        </ContentTemplate>
        </cc1:TabPanel>

    </cc1:TabContainer>
        

</asp:Content>
